package com.wxf.producer;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Start {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("spring-rabbitmq.xml");
        RabbitTemplate rabbitTemplate = ac.getBean("rabbitTemplate",RabbitTemplate.class);
        rabbitTemplate.convertAndSend("","spring_queue","spring-simple");
        rabbitTemplate.convertAndSend("spring_fanout_exchange","spring_fanout_queue_1","fanout-queue-1");
        rabbitTemplate.convertAndSend("spring_fanout_exchange","spring_fanout_queue_2","fanout-queue-2");
        rabbitTemplate.convertAndSend("spring_direct_exchange","insert","路由模式，发给insert的");
        rabbitTemplate.convertAndSend("spring_direct_exchange","update","路由模式，发给update的");
        rabbitTemplate.convertAndSend("spring_topic_exchange","test.all","topic模式，发给all的");
        rabbitTemplate.convertAndSend("spring_topic_exchange","test.insert","topic模式，发给all和insert的");
        rabbitTemplate.convertAndSend("spring_topic_exchange","test.update","topic模式，发给all和update的");
    }
}
